package org.dea.facade;

import java.io.File;

import junit.framework.TestCase;

import org.dea.util.CheckSummer;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

public class SwitchFacadeMakerTest extends TestCase  {
	
	String fileGenerated = "test/SwitchSimple.java";
	String fileExpected = "test2/SwitchSimple.java";

	@Before
	public void setUp() throws Exception {
		new File(fileGenerated).delete();
	}

	@After
	public void tearDown() throws Exception {
		new File(fileGenerated).delete();
	}

	@Test
	public void testGenerateFacade() throws Exception {
		new SwitchFacadeMaker("test/xml/onlyAlpha.xml").generateFacade(new File("test"), "Simple");
		assertTrue(new File(fileGenerated).exists());
		assertEquals(new File(fileExpected).length(),new File(fileGenerated).length());
		assertEquals( CheckSummer.createStringChecksum(fileExpected), CheckSummer.createStringChecksum(fileGenerated) );
	}

}
